/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Entidades;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 *
 * @author USUARIO
 */
@Entity
@Table(name = "pago")
@NamedQueries({
    @NamedQuery(name = "Pago.findAll", query = "SELECT p FROM Pago p")})
public class Pago implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "nro_transaccion")
    private Integer nroTransaccion;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Basic(optional = false)
    @Column(name = "importe")
    private BigDecimal importe;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "pago")
    private Tarjeta tarjeta;
    @JoinColumn(name = "factura", referencedColumnName = "nro_factura")
    @ManyToOne
    private Factura factura;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "pago")
    private Efectivo efectivo;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "pago")
    private Cheque cheque;

    public Pago() {
    }

    public Pago(Integer nroTransaccion) {
        this.nroTransaccion = nroTransaccion;
    }

    public Pago(Integer nroTransaccion, BigDecimal importe) {
        this.nroTransaccion = nroTransaccion;
        this.importe = importe;
    }

    public Integer getNroTransaccion() {
        return nroTransaccion;
    }

    public void setNroTransaccion(Integer nroTransaccion) {
        this.nroTransaccion = nroTransaccion;
    }

    public BigDecimal getImporte() {
        return importe;
    }

    public void setImporte(BigDecimal importe) {
        this.importe = importe;
    }

    public Tarjeta getTarjeta() {
        return tarjeta;
    }

    public void setTarjeta(Tarjeta tarjeta) {
        this.tarjeta = tarjeta;
    }

    public Factura getFactura() {
        return factura;
    }

    public void setFactura(Factura factura) {
        this.factura = factura;
    }

    public Efectivo getEfectivo() {
        return efectivo;
    }

    public void setEfectivo(Efectivo efectivo) {
        this.efectivo = efectivo;
    }

    public Cheque getCheque() {
        return cheque;
    }

    public void setCheque(Cheque cheque) {
        this.cheque = cheque;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (nroTransaccion != null ? nroTransaccion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Pago)) {
            return false;
        }
        Pago other = (Pago) object;
        if ((this.nroTransaccion == null && other.nroTransaccion != null) || (this.nroTransaccion != null && !this.nroTransaccion.equals(other.nroTransaccion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.Pago[ nroTransaccion=" + nroTransaccion + " ]";
    }
    
}
